<?php

namespace Entity;

class Domain extends \Home {

	public $www;

	public $admin;

	public $wap;

	public $api;

	public $authWeibo;

	public function __construct() {
        $fromUrl = !empty($_GET['fromurl']) ? $_GET['fromurl'] : '/';
        $fromUrl = urldecode($fromUrl);
		$serverName = $_SERVER['SERVER_NAME'];
		$d = strstr($serverName, '.');
		$this->www = 'http://www' . $d;
		$this->admin = 'http://admin' . $d;
		$this->wap = 'http://wap' . $d;
		$this->api = 'http://api' . $d;
		$this->authWeibo = 'https://api.weibo.com/oauth2/authorize?client_id=' .
			\Config\OAuth::WEIBO_CLIENT_ID .
			'&response_type=code&redirect_uri=' .
			urlencode($this->www . '/OAuth/Weibo?fromurl=' . $fromUrl);
	}

}